package SERVER;
import java.util.Random;
import java.util.Scanner;


//klasa do sprawdzania dzialania - nie usuwaj ;)
public class testy {

	public static void main(String[] args) {
		/*Card karta = new Card(20);
		System.out.println(karta.getColor() + "-" + karta.getValue());
		karta.setCard(3,2);
		System.out.println(karta.getColor() + "-" + karta.getValue()+ " z 4,12");
		System.out.println(karta.getId());*/
		
		
		System.out.println("zaczynamy");
		Hand hand = new Hand();
		hand.setCard(0,3,4);
		hand.setCard(1,3,7);
		hand.setCard(2,4,3);
		hand.setCard(3,3,3);
		System.out.println("przed, liczba kolorow: ");
		
		for (int i=0; i<4; i++)
		{
			System.out.println(hand.getCardColor(i) + "-" + hand.getCardValue(i));
		}
		Card [] a = hand.chooseCardsToCheck();
		System.out.println("Wybieram karty do liczenia ukladu");
		for (int i=0; i<a.length; i++)
		{
			System.out.println(a[i].getColor() + "-" + a[i].getValue());
		}
		System.out.println("Wartosc ukladu: " + hand.handValue());
		int aa =13;
		int b = 0;
		int c = (int)Math.pow(aa,b);
		System.out.println("potega " + aa + " do " + b + " = " + c);
		Random generator = new Random();
		Hand hand2 = new Hand();
		String txt = new String ("x");
		//sprawdzanie dzialania id kart
		Card [] karty = new Card[52];
		for (int i=0; i<karty.length; i++)
		{
			karty[i] = new Card(i+1);
		}
		System.out.println("po wstawieniu wypisuje: id : kolor - wartosc");
		for (int i=0; i<karty.length; i++)
		{
			System.out.println(karty[i].getId() + ": " + karty[i].getColor() + "-" + karty[i].getValue());
		}
		for (int y=0; y<5; y++)
		{
			boolean [] taken = new boolean [52];
			for (int i=0; i< taken.length; i++) taken[i] = false;
			int losowa = 0;
				for (int i=0; i<4; i++)
				{
					do
					{
						losowa = generator.nextInt(52)+1;
					}
					while (taken[losowa-1]==true);
					taken[losowa-1]=true;
					//System.out.println("wpisuje id " + losowa);
					hand.setCard(i, losowa);
				}
				for (int i=0; i<4; i++)
				{
					do
					{
						losowa = generator.nextInt(52)+1;
					}
					while (taken[losowa-1]==true);
					taken[losowa-1]=true;
					//System.out.println("wpisuje id " + losowa);
					hand2.setCard(i, losowa);
				}
			String s;
			System.out.println("*******************");
			for(int i=0; i<4; i++)
			{
				System.out.println(hand.getCardColor(i) + "-" + hand.getCardValue(i));
			}
			if (hand.handValue()<hand2.handValue()) System.out.println("Przegrywa z:"); else System.out.println("Wygrywa z:");
			for(int i=0; i<4; i++)
			{
				System.out.println(hand2.getCardColor(i) + "-" + hand2.getCardValue(i));
			}
			/*Scanner odczyt = new Scanner(System.in);
			txt = odczyt.nextLine();*/
		}
		
	}

}
